package com.zx.tfw.enums;

import java.util.HashMap;
import java.util.Map;

public enum CountryEnum {

    China(1, "中国"),
    America(2, "美国"),
    England(3, "英国"),
    Russia(4, "俄罗斯"),
    Japanese(5, "日本"),
    Korea(6, "韩国");

    private static final Map<Integer, CountryEnum> map;

    static {
        map = new HashMap<>();
        CountryEnum[] values = CountryEnum.values();
        for (CountryEnum typeEnum : values) {
            map.put(typeEnum.getCode(), typeEnum);
        }
    }

    private int code;
    private String name;

    CountryEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static Map<Integer, CountryEnum> asMap() {
        return map;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
